/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f5f7fa;
    color: #1f2937;
    width: 100%;
    min-height: 100vh;
    margin: 0 auto;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 颜色变量 */
:root {
    --primary: #4CAF50;
    --secondary: #8BC34A;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;
}

/* 字体 */
.pacifico {
    font-family: 'Pacifico', serif;
}

/* 布局 */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.justify-between {
    justify-content: space-between;
}

.justify-around {
    justify-content: space-around;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

/* 间距 */
.p-4 {
    padding: 1rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-2 {
    padding: 0.5rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.pt-16 {
    padding-top: 4rem;
}

.pb-20 {
    padding-bottom: 5rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.w-full {
    width: 100%;
}

.w-6 {
    width: 1.5rem;
}

/* 文本样式 */
.text-2xl {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-lg {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.text-xs {
    font-size: 0.75rem;
}

.font-bold {
    font-weight: 700;
}

.font-medium {
    font-weight: 500;
}

.text-left {
    text-align: left;
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--secondary);
}

.text-white {
    color: var(--white);
}

.text-gray-400 {
    color: var(--gray-400);
}

.text-gray-500 {
    color: var(--gray-500);
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: var(--gray-700);
}

/* 背景 */
.bg-white {
    background-color: var(--white);
}

.bg-primary {
    background-color: var(--primary);
}

.bg-gray-50 {
    background-color: var(--gray-50);
}

.bg-gradient-green {
    background-image: linear-gradient(to right, #f0fdf4, #dcfce7);
}

/* 边框 */
.border-b {
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.border-t {
    border-top-width: 1px;
    border-top-style: solid;
}

.border-gray-100 {
    border-color: var(--gray-100);
}

/* 圆角 */
.rounded-lg {
    border-radius: 0.75rem;
}

.rounded-button {
    border-radius: 4px;
}

/* 阴影 */
.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 导航栏 */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--white);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.nav-container {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 主内容区 */
.main-content {
    padding: 1rem;
    padding-top: 3.5rem;
    padding-bottom: 4rem;
    max-width: 768px;
    margin: 0 auto;
}

/* 搜索按钮 */
#search {
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

#search:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.1);
}

/* 信息卡片 */
.info-card {
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-100);
}

.info-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-item:first-child {
    padding-top: 0;
}

/* 分析报告 */
.analysis-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.1);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(76, 175, 80, 0.1);
}

/* 表格容器 */
.table-container {
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid var(--gray-100);
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    background-color: var(--primary);
    color: var(--white);
}

th {
    padding: 1rem;
    font-weight: 600;
    text-align: left;
    font-size: 0.875rem;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: var(--gray-50);
}

/* 历史记录列表 */
.history-list {
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid var(--gray-100);
}

.history-item {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background-color: var(--gray-50);
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-date {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.history-summary {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.history-weather,
.history-crop {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.history-weather::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--primary);
    margin-right: 0.25rem;
}

.history-crop::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--secondary);
    margin-right: 0.25rem;
}

/* 底部导航 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--white);
    box-shadow: 0 -1px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.tab-container {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tab-active {
    color: var(--primary);
}

.tab-inactive {
    color: var(--gray-400);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--white);
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background-color: var(--primary);
    color: var(--white);
    padding: 1.25rem;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: center;
}

.btn {
    background-color: var(--primary);
    color: var(--white);
    padding: 0.75rem 2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: #43a047;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
}

/* 其他工具类 */
.icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
}

.divide-y > * + * {
    border-top: 1px solid var(--gray-100);
}

/* 响应式调整 */
@media (max-width: 640px) {
    .main-content {
        padding: 0.75rem;
        padding-top: 3.5rem;
    }
    
    .info-card,
    .analysis-card,
    .table-container,
    .history-list {
        border-radius: 8px;
    }
    
    th, td {
        padding: 0.75rem;
    }
    
    .history-item {
        padding: 0.875rem;
    }
    
    .history-date {
        font-size: 0.9375rem;
    }
    
    .history-summary {
        font-size: 0.8125rem;
        gap: 0.75rem;
    }
}
